<?php


namespace App\Http\Controllers\admin\validate;


use Illuminate\Support\Facades\Validator;

class App
{
    public static function uploadApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'file'=>'required|file',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'file.required'=>'文件为空',
            'file.file'=>'文件格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'appName'=>'required',
            'versionName'=>'required',
            'pakName'=>'required',
            'versionCode'=>'required',
            'appSize'=>'required|numeric',
            'appUrl'=>'required',
            'appImg'=>'required',
            'appMd5'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'appName.required'=>'应用名为空',
            'versionName.required'=>'版本为空',
            'pakName.required'=>'包名为空',
            'versionCode.required'=>'内部版本号为空',
            'appSize.required'=>'应用大小为空',
            'appSize.numeric'=>'应用大小格式不对',
            'appUrl.required'=>'应用地址为空',
            'appImg.required'=>'应用图片为空',
            'appMd5.required'=>'文件md5为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryAdminAppList($param){
        $rules = [
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdAdminAppList($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
    
    public static function installAdminApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'snId'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'snId.required'=>'编号为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdApp($param){
        $rules = [
            'id'=>'required|numeric',
            'type'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
            'appName'=>'required',
            'versionName'=>'required',
            'pakName'=>'required',
            'versionCode'=>'required',
            'appSize'=>'required|numeric',
            'appUrl'=>'required',
            'appImg'=>'required',
            'appMd5'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
            'appName.required'=>'应用名为空',
            'versionName.required'=>'版本为空',
            'pakName.required'=>'包名为空',
            'versionCode.required'=>'内部版本号为空',
            'appSize.required'=>'应用大小为空',
            'appSize.numeric'=>'应用大小格式不对',
            'appUrl.required'=>'应用地址为空',
            'appImg.required'=>'应用图片为空',
            'appMd5.required'=>'文件md5为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryAdminApp($param){
        $rules = [
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryTeacherApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryParentApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryBatchName($param){
        $rules = [
            'userId'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function uploadPreviewImg($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'file'=>'required|file'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'file.required'=>'图片为空',
            'file.file'=>'图片格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addAppUpdate($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'appName'=>'required',
            'packageName'=>'required',
            'versionName'=>'required',
            'versionCode'=>'required',
            'appSize'=>'required|numeric',
            'appDesc'=>'required',
            'appMd5'=>'required',
            'appUrl'=>'required',
            'status'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'appName.required'=>'应用名称为空',
            'packageName.required'=>'包名为空',
            'versionName.required'=>'版本号为空',
            'versionCode.required'=>'内部版本号为空',
            'appSize.required'=>'应用大小为空',
            'appSize.numeric'=>'应用大小格式不对',
            'appDesc.required'=>'应用描述为空',
            'appMd5.required'=>'应用md5为空',
            'appUrl.required'=>'应用地址为空',
            'status.required'=>'平台为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryAppUpdate($param){
        $rules = [
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdAppUpdate($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function updateAppUpdate($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'lastIp'=>'required|ip',
            'appName'=>'required',
            'packageName'=>'required',
            'versionName'=>'required',
            'versionCode'=>'required',
            'appSize'=>'required|numeric',
            'appDesc'=>'required',
            'appMd5'=>'required',
            'appUrl'=>'required',
            'status'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'appName.required'=>'应用名称为空',
            'packageName.required'=>'包名为空',
            'versionName.required'=>'版本号为空',
            'versionCode.required'=>'内部版本号为空',
            'appSize.required'=>'应用大小为空',
            'appSize.numeric'=>'应用大小格式不对',
            'appDesc.required'=>'应用描述为空',
            'appMd5.required'=>'应用md5为空',
            'appUrl.required'=>'应用地址为空',
            'status.required'=>'平台为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteAppUpdate($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addAppTest($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'appName'=>'required',
            'packageName'=>'required',
            'versionName'=>'required',
            'versionCode'=>'required',
            'appSize'=>'required|numeric',
            'appDesc'=>'required',
            'appMd5'=>'required',
            'appUrl'=>'required',
            'file'=>'required|file'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'appName.required'=>'应用名称为空',
            'packageName.required'=>'包名为空',
            'versionName.required'=>'版本号为空',
            'versionCode.required'=>'内部版本号为空',
            'appSize.required'=>'应用大小为空',
            'appSize.numeric'=>'应用大小格式不对',
            'appDesc.required'=>'应用描述为空',
            'appMd5.required'=>'应用md5为空',
            'appUrl.required'=>'应用地址为空',
            'file.required'=>'文件为空',
            'appUrl.file'=>'文件格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryAppTest($param){
        $rules = [
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteAppTest($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function packageNameQuerySn($param){
        $rules = [
            'userId'=>'required|numeric',
            'packageName'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'packageName.required'=>'包名不能为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addSysApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'app_name'=>'required',
            'app_package'=>'required',
            'app_img'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'app_name.required'=>'应用名为空',
            'app_package.required'=>'应用包名为空',
            'app_img.required'=>'应用图标为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function querySysApp($param){
        $rules = [
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdSysApp($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editSysApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'lastIp'=>'required|ip',
            'app_name'=>'required',
            'app_package'=>'required',
            'app_img'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'app_name.required'=>'应用名为空',
            'app_package.required'=>'应用包名为空',
            'app_img.required'=>'应用图标为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteSysApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
}